package com.cryrabbit.yyystitp.net;

import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by CryRabbit on 2016/11/3.
 */

public class PushHttpMethods extends BaseHttpMethods {
    private PushHttpMethods.PushService PushService;
    public PushHttpMethods(){
        super();
        PushService=retrofit.create(PushHttpMethods.PushService.class);
    }
    public void getNet(Subscriber<String> stringSubscriber, String user, String name,String content,String city,String kind,String pay,String length){
        PushService.getResult(user,name,content,city,kind,pay,length)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(stringSubscriber);
    }
    private interface PushService{
        @Headers({"Content-Type:application/x-www-form-urlencoded;charset=UTF-8"})
        @POST("tiezi/Push")
        Observable<String> getResult(@Query("user") String user, @Query("name") String name, @Query("content") String content
                , @Query("city") String city, @Query("kind") String kind, @Query("pay") String pay, @Query("length") String length);
    }
}
